package com.example.borui.partpositionproject.simple.partposition.divider;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.example.borui.partpositionproject.simple.utils.Utils;

/**
 * @author borui
 * @描述: 公用分割线 holder
 * @Copyright Copyright (c) 2016
 * @Company 昆山妈妈好网络科技有限公司
 * @date 2017/6/2
 */
public class DividerLineViewHolder extends RecyclerView.ViewHolder {

    public DividerLineViewHolder(View itemView) {
        super(itemView);
        if(null != itemView){
            RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.dip2px(itemView.getContext(), 10));
            itemView.setLayoutParams(params);
            itemView.setBackgroundColor(0xfff0f0f0);
        }
    }

    public void init(){
        if(null != itemView){
            RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.dip2px(itemView.getContext(), 10));
            itemView.setLayoutParams(params);
            itemView.setBackgroundColor(0xfff0f0f0);
        }
    }

    public void init(int height){
        if(null != itemView){
            RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);
            itemView.setLayoutParams(params);
            itemView.setBackgroundColor(0xfff0f0f0);
        }
    }
}